<?php
$headermsg = '\"HTTP/1.0 '.$code[0].' '.$code[1].'\"';
header($headermsg);
echo "<photos>";
foreach($photodata as $photos){

echo "<photo "
		."id=\"".$photos['Photo']['id']."\" "
		."created=\"".$photos['Photo']['created']."\" "
		."title=\"".$photos['Photo']['title']."\" "
		."width=\"".$photos['Photo']['width']."\" "
		."height=\"".$photos['Photo']['height']."\" "
		."geo_lat=\"".$photos['Photo']['geo_lat']."\" "
		."geo_long=\"".$photos['Photo']['geo_long']."\" "
		."aperture=\"".$photos['Photo']['aperture']."\" "
		."exposuretime=\"".$photos['Photo']['exposuretime']."\" "
		."focallength=\"".$photos['Photo']['focallength']."\" "
		."views=\"".$photos['Photo']['views']."\" "
		."original_filename=\"".$photos['Photo']['original_filename']."\" "
		."user_name=\"".$photos['Photo']['user_name']."\" "
		."author=\"".$photos['Photo']['user_id']."\">";

echo "<ratings>";
$ratings = $photos['Rating'];
foreach($ratings as $rating){
	echo "<rating ";
	echo "id=\"".$rating['id']."\" ";
	echo "photo_id=\"".$rating['photo_id']."\" ";
	echo "user_id=\"".$rating['user_id']."\" ";
	echo "value=\"".$rating['value']."\"/>";
}
echo "</ratings>";

echo "<tags>";
$tags = $photos['Tag'];
foreach($tags as $tag){
	echo "<tag ";
	echo "id=\"".$tag['id']."\" ";
	echo "photo_id=\"".$tag['photo_id']."\" ";
	echo "tag_name=\"".$tag['tag_name']."\" />";
}
echo "</tags>";

echo "<description>".$photos['Photo']['description']."</description>";
echo "</photo>";		
}
echo "</photos>";
?>